<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: kurong
  Date: 2021/10/8
  Time: 20:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>详情</title>
</head>
<body>
全部信息:${serverResponse.data.images}
<br>
<%--${serverResponse.data.color}--%>

<%-- color按钮--%>

<c:forEach var="color" items="${serverResponse.data.color}">
    <c:if test="${!(color eq serverResponse.data.product.proColor)}">
        <button class="color">${color}</button>
    </c:if>
    <c:if test="${color eq serverResponse.data.product.proColor}">
        <button class="color" style="background-color: yellow">${color}</button>
    </c:if>
</c:forEach>

<br>

<%-- memory按钮--%>
<c:forEach var="memory" items="${serverResponse.data.memory}">
    <c:if test="${!(memory eq serverResponse.data.product.proMemory)}">
        <button class="memory">${memory}</button>
    </c:if>
    <c:if test="${memory eq serverResponse.data.product.proMemory}">
        <button class="memory" style="background-color: deepskyblue">${memory}</button>
    </c:if>

</c:forEach>



<br>
<%--  图片 --%>
<c:forEach var="images" items="${serverResponse.data.images}"  varStatus="s">
<%--    <td>${s.count}</td>--%>
    <img src="${images}">
    <c:if test="${s.count%5 == 0}">
            <td>${s.count}</td>

        <a>第五个</a>

    </c:if>
</c:forEach>


<%--  点击跳转链接  --%>
<script type="text/javascript" src="../res/jquery/jquery-3.5.1.js"></script>
<script type="text/javascript">
    $(".color").click(function goByColor(){

        // this.hide();
        var proNme="${serverResponse.data.product.proName}";
        var proColor=this.innerText;
        var proMemory="${serverResponse.data.product.proMemory}";
        proMemory=proMemory.replace(/\+/g,"%2B");

        console.log(proNme);
        console.log(proColor);
        console.log(proMemory);
        window.location.href = 'coditions?proName='+proNme+'&proColor='+proColor+'&proMemory='+proMemory;
    });
    $(".memory").click(function goByMemory(){

        // this.hide();
        var proNme="${serverResponse.data.product.proName}";
        var proColor="${serverResponse.data.product.proColor}";
        var proMemory=this.innerText;
        proMemory=proMemory.replace(/\+/g,"%2B");

        console.log(proNme);
        console.log(proColor);
        console.log(proMemory);
        window.location.href = 'coditions?proName='+proNme+'&proColor='+proColor+'&proMemory='+proMemory;
    });
</script>
</body>
</html>
